package base;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Human01 {

    private String name;

    private int age;

    private boolean istrue = false;

    public Human01() {
    }

    public Human01(String name) {
        this.name = name;
    }

    public Human01(String name, int age, boolean istrue) {
        this.name = name;
        this.age = age;
        this.istrue = istrue;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isIstrue() {
        return istrue;
    }

    public void setIstrue(boolean istrue) {
        this.istrue = istrue;
    }

    public String introduce() {
        String str = this.istrue ? "是党员" : "不是党员";
       return "我是" + this.name + ",今年" + this.age + ",现在" + str;
    }


    public static void main(String[] args) {

        //基本数据类型 int , flout, double,
        int a = 1;
        Integer a1 = 1;
        double b = 1.2;
        Double b1 = 1.3;
        BigDecimal  c = new BigDecimal("1.2");

        // 集合数据类型
        // 集合数据类型，可以放基础类型，和包装类型，还能放对象，还能放对象集合
        List<String> list = new ArrayList<>();
        list.add("张三");
        list.add("李四");
        list.add(1, "王五");
        //list.add(2);
        for (String s : list) {
            System.out.println(s);
        }
        System.out.println("===> list.get(2): "+list.get(2));

        List<Integer> list2 = new ArrayList<>();
        //list2.add("221");
        list2.add(111);


        // list - 对象
        // 1班 ： 2个人
        List<Human01> class01 = new ArrayList<>();

        Human01 zhangsan = new Human01("张三", 19, true);
        class01.add(zhangsan);

        Human01 lisi = new Human01("李四", 18, false);
        class01.add(lisi);


        // 2班 ：3人
        List<Human01> class02 = new ArrayList<>();

        Human01 wagnwu = new Human01("王五",20, true);
        class02.add(wagnwu);

        Human01 zhaoliu = new Human01("赵六",22,  false);
        class02.add(zhaoliu);

        Human01 tianqi = new Human01("田七", 12, true);
        class02.add(tianqi);

        //年级 2个班
        List<List<Human01>> grade = new ArrayList<>();
        grade.add(class01);
        grade.add(class02);


        // 查找2班，最年轻的党员
        Human01 result = FindUtils.findYongestOne(class02);
        System.out.println(result.introduce());
    }




}
